package com.yunshipei.core.model;

import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;

public class HttpAuthModel implements Parcelable {
    private String host;
    private String userName;
    private String password;

    public HttpAuthModel(@NonNull String host, @NonNull String userName, @NonNull String password) {
        this.host = host;
        this.userName = userName;
        this.password = password;
    }

    protected HttpAuthModel(Parcel in) {
        host = in.readString();
        userName = in.readString();
        password = in.readString();
    }

    public static final Creator<HttpAuthModel> CREATOR = new Creator<HttpAuthModel>() {
        @Override
        public HttpAuthModel createFromParcel(Parcel in) {
            return new HttpAuthModel(in);
        }

        @Override
        public HttpAuthModel[] newArray(int size) {
            return new HttpAuthModel[size];
        }
    };

    public String getHost() {
        return host;
    }

    public String getUserName() {
        return userName;
    }

    public String getPassword() {
        return password;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(host);
        dest.writeString(userName);
        dest.writeString(password);
    }

    @Override
    public String toString() {
        return host + "\n" + userName;
    }
}
